package com.tbit.uqbike.object.pojo.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.tbit.uqbike.annos.Excel;
import com.tbit.uqbike.constant.CsvConstant;
import com.tbit.uqbike.object.pojo.SubAccountLog;
import com.tbit.uqbike.webmanager.util.csv.annotations.Csv;
import com.tbit.uqbike.webmanager.util.csv.annotations.Sum;
import lombok.Data;

/**
 * 用户分账日志返回对象
 *
 * @Author:BUGTian
 * @DATE: 2022/5/26
 */
@Data
public class SubAccountLogVO extends SubAccountLog {

    /**
     * 可分账金额
     */
    private Integer canBeSubMoney;

    /**
     * 汇付到账
     */
    private Integer adPayMoney;

    /**
     * 其他平台到账
     */
    private Integer otherMoney;


    /**
     * ===以下是导出相关转换===
     */
    @JSONField(serialize = false)
    @Excel(name = "区域", sort = 2)
    @Csv(name = "区域", type = CsvConstant.CSV_TYPE_WITHOUT)
    private String areaName;

    @JSONField(serialize = false)
    @Excel(name = "订单金额", sort = 5)
    @Csv(name = "订单金额", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Sum
    private String rechargeMoneyYuan;

    @JSONField(serialize = false)
    @Excel(name = "平台服务费(所有平台汇总)", sort = 6)
    @Csv(name = "平台服务费(所有平台汇总)", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Sum
    private String serviceFeeYuan;

    @JSONField(serialize = false)
    @Excel(name = "可分账金额(所有平台汇总)", sort = 7)
    @Csv(name = "可分账金额(所有平台汇总)", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Sum
    private String canBeSubMoneyYuan;

    @JSONField(serialize = false)
    @Excel(name = "账号", sort = 8)
    @Csv(name = "账号", type = CsvConstant.CSV_TYPE_WITHOUT)
    private String nickName;

    @JSONField(serialize = false)
    @Excel(name = "分账金额", sort = 10)
    @Csv(name = "分账金额", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Sum
    private String moneyYuan;

    @JSONField(serialize = false)
    @Excel(name = "汇付手续费", sort = 11)
    @Csv(name = "汇付手续费", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Sum
    private String feeYuan;

    @JSONField(serialize = false)
    @Excel(name = "汇付到账", sort = 12)
    @Csv(name = "汇付到账", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Sum
    private String adPayMoneyYuan;

    @Excel(name = "用户编号", sort = 13)
    @Csv(name = "用户编号", type = CsvConstant.CSV_TYPE_WITHOUT)
    private String userNO;

    @Excel(name = "汇付充值订单号", sort = 13)
    @Csv(name = "汇付充值订单号", type = CsvConstant.CSV_TYPE_WITHOUT)
    private String paymentId;



    /**
     * 单位转换
     */
    public void unitConversion() {
        this.rechargeMoneyYuan = String.format("%.2f", ((double) getRechargeMoney() / 100D));
        this.serviceFeeYuan = String.format("%.2f", ((double) getServiceFee() / 100D));
        this.canBeSubMoneyYuan = String.format("%.2f", ((double) getCanBeSubMoney() / 100D));
        this.moneyYuan = String.format("%.2f", ((double) getMoney() / 100D));
        this.feeYuan = String.format("%.2f", ((double) getFee() / 100D));
        this.adPayMoneyYuan = String.format("%.2f", ((double) getAdPayMoney() / 100D));
    }
}
